package cn.com.bluemoon.daps.model.entity;


import cn.com.bluemoon.daps.common.domain.BaseModel;
import cn.com.bluemoon.daps.common.domain.UserPermissionApi;
import cn.com.bluemoon.daps.model.dto.SimpleFieldDto;
import cn.com.bluemoon.daps.model.dto.SimpleTableDto;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;
import java.util.List;

@Data
@Accessors
@ApiModel(value = "DapDataModelTableForeignKey", description = "数据模型外键关系表")
public class DapDataModelTableForeignKey extends BaseModel<DapDataModelTableForeignKey>{

    @ApiModelProperty("id")
    private String id;

    @ApiModelProperty("主表模型id")
    @NotNull(message = "主表模型id不能为空")
    private String modelId;

    @ApiModelProperty("主表id")
    @NotNull(message = "主表id不能为空")
    private String modelTableId;

    @ApiModelProperty("主表字段id")
    @NotNull(message = "主表字段id不能为空")
    private String modelTableFieldId;

    @ApiModelProperty(value = "当前字段名", hidden = true)
    @TableField(exist = false)
    private String fieldName;

    @ApiModelProperty("副表模型id")
    @NotNull(message = "副表模型id不能为空")
    private String referenceModelId;

    @ApiModelProperty(value = "副表模型名", hidden = true)
    @TableField(exist = false)
    private String referenceModelName;

    @ApiModelProperty("副表id")
    @NotNull(message = "副表id不能为空")
    private String referenceTableId;

    @ApiModelProperty(value = "副表名", hidden = true)
    @TableField(exist = false)
    private String referenceFieldName;

    @ApiModelProperty("副表字段id")
    @NotNull(message = "副表字段id不能为空")
    private String referenceFieldId;

    @ApiModelProperty(value = "副表字段名", hidden = true)
    @TableField(exist = false)
    private String referenceTableName;

    @ApiModelProperty("关系")
    @NotNull(message = "表间关系不能为空")
    private String relation;

    @ApiModelProperty(hidden = true)
    @TableField(exist = false)
    private String relationName;

    @ApiModelProperty(value = "表列表", required = false,hidden=true)
    @TableField(exist = false)
    private List<SimpleTableDto> referTableList;

    @ApiModelProperty(value = "字段列表", required = false,hidden=true)
    @TableField(exist = false)
    private List<SimpleFieldDto> referFieldList;

    /**
     * 用于查询字段+表名的对象
     */
    @ApiModelProperty(value = "表英文名称", hidden = true)
    @TableField(exist = false)
    private String tableName;

}
